package ltd.hanamaki.study.oop.demo09;

public class MainTeat {


    public static void main(String[] args) {

        /* instanceof 判断两个类之间 是否存在 父子关系 */
//        System.out.println(x instanceof y);
        Object object = new Student();
        System.out.println(object instanceof Student);
        System.out.println(object instanceof Person);
        System.out.println(object instanceof Object);
        System.out.println(object instanceof Teacher);
        System.out.println(object instanceof String);

        System.out.println("======================");

        Person person = new Student();
        System.out.println(person instanceof Student);
        System.out.println(person instanceof Person);
        System.out.println(person instanceof Object);
        System.out.println(person instanceof Teacher);
//        System.out.println(person instanceof String); // 编译出错

        System.out.println("==================");

        Student student = new Student();
        System.out.println(student instanceof Student);
        System.out.println(student instanceof Person);
        System.out.println(student instanceof Object);
//        System.out.println(student instanceof Teacher); // 编译报错
    }
}
